package cn.iocoder.yudao.module.pypm.dal.mysql.attachment;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pypm.dal.dataobject.attachment.AttachmentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pypm.controller.admin.attachment.vo.*;

/**
 * 附件信息 Mapper
 *
 * @author 钦州码头
 */
@Mapper
public interface AttachmentMapper extends BaseMapperX<AttachmentDO> {

    default PageResult<AttachmentDO> selectPage(AttachmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttachmentDO>()
                .eqIfPresent(AttachmentDO::getProjectId, reqVO.getProjectId())
                .betweenIfPresent(AttachmentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(AttachmentDO::getRelevanceId, reqVO.getRelevanceId())
                .likeIfPresent(AttachmentDO::getFileName, reqVO.getFileName())
                .eqIfPresent(AttachmentDO::getFilePath, reqVO.getFilePath())
                .eqIfPresent(AttachmentDO::getUrl, reqVO.getUrl())
                .eqIfPresent(AttachmentDO::getFileType, reqVO.getFileType())
                .likeIfPresent(AttachmentDO::getRelevanceName, reqVO.getRelevanceName())
                .likeIfPresent(AttachmentDO::getOriginalFileName, reqVO.getOriginalFileName())
                .eqIfPresent(AttachmentDO::getNetUrl, reqVO.getNetUrl())
                .orderByDesc(AttachmentDO::getId));
    }

}